// 小程序登录
// POST

import { LoginByPasswordResult, LoginResult } from '../types/member'
import { http } from '../utils/http'

interface LoginByWeixinData {
  code: string
  encryptedData: string
  iv: string
}
// /login/wxMin
export const loginByWeixinAPI = (data: LoginByWeixinData) => {
  return http<LoginResult>({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}

// 传统登录-用户名+密码
// POST
// /login
interface LoginByPasswordData {
  /**
   * 用户名或手机号
   */
  account: string
  /**
   * 密码
   */
  password: string
}
export const loginByPasswordAPI = (data: LoginByPasswordData) => {
  return http<LoginByPasswordResult>({
    method: 'POST',
    url: '/login',
    data,
  })
}
